/*获得流媒体信息*/
#include "libavutil/log.h"
#include "libavformat/avformat.h"

int main(int argc, char* argv[]){
	AVFormatContext *fmt_ctx = NULL;
	int let;
	const char *in_filename;

	av_log_set_level(AV_LOG_INFO);
	 if (argc < 2) {
        	printf("usage: %s input output\n"
               		"API example program to remux a media file with libavformat and libavcodec.\n"
               		"The output format is guessed according to the file extension.\n"
               		"\n", argv[0]);
        	return 1;
    	}

    	in_filename  = argv[1];

	/* 第一步 注册*/
	av_register_all();

	
	/* 第二步 打开*/
	let = avformat_open_input(&fmt_ctx, in_filename, NULL, NULL);
	if(let <0){
		av_log(NULL, AV_LOG_ERROR, "can not open file: %s !\n", av_err2str(let));
		return -1;
	}
	/* 打印媒体信息*/
	av_dump_format(fmt_ctx, 0, "./source.mp4", 0);
	/* 第三步 关闭*/
	avformat_close_input(&fmt_ctx);
	return 0;
}
